<?php
namespace app\admin\controller;
use \think\Controller;
use \think\Session;
use \think\Db;
class Formnewscomment extends Common
{
	

  public function editnewscomment(){
    $comment = Db::name('newscomment')->where('comment_id',input('commentid'))->find();
    $this->assign('comment',$comment);
    return $this->fetch();
  }


  public function edit(){
    $info = '';
     if(request()->isPost()){  
        $data=[
          'comment_content'=>input('content'),
        ];
        $res=Db::name('newscomment')->where('comment_id',input('commentid'))->update($data);
        if ($res!==false){
          $this->success("修改新闻评论成功",'newscomment/index');
        }
        else {
          $this->error("修改失败");
        }
      }
  }

  public function delete(){
    $res = Db::name('newscomment')->where('comment_id',input('commentid'))->update(['comment_status'=>input('statu')]);
    if($res===false){
        $this->error("处理失败",'newscomment/index');
    }
    $this->redirect('newscomment/index');
  }

  
}